package gold.digger;

import gold.utils.InputUtil;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1010 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int numPairsDivisibleBy60(int[] time) {
            int[] cnt = new int[60];
            int ans = 0;
            for (int n : time) {
                ans += cnt[(60 - n % 60) % 60];
                cnt[n % 60]++;
            }

            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.numPairsDivisibleBy60(InputUtil.toIntegerArray("[30,20,150,100,40]")));
        System.out.println(solution.numPairsDivisibleBy60(InputUtil.toIntegerArray("[60,60,60]")));
    }

    public static void main(String[] args) throws Exception {
        LC1010 an = new LC1010();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
